import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shenfuhui/config/config.dart';

import '../routers/routers.dart';
import '../views/dialog_manager.dart';

///
/// 资产金券页面
///
class AssetGoldDetail extends StatefulWidget {
  const AssetGoldDetail({Key? key}) : super(key: key);

  @override
  State<AssetGoldDetail> createState() => _AssetGoldDetailState();
}

class _AssetGoldDetailState extends State<AssetGoldDetail> {
  ///
  /// 返回普通的列表item
  ///
  Widget getListItem(String title, String subTitle) {
    return Container(
      height: 124.w,
      padding: EdgeInsets.symmetric(vertical: 20.w, horizontal: 20.w),
      decoration: BoxDecoration(
        border:
            Border(bottom: BorderSide(width: 3.w, color: Config.colorDivider)),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                "报单",
                style: TextStyle(
                  fontSize: 24.w,
                  color: Config.colorText1,
                ),
              ),
              Padding(padding: EdgeInsets.only(top: 8.w)),
              Text(
                "2023-01-31 08：01",
                style: TextStyle(
                  fontSize: 24.w,
                  color: Config.colorText3,
                ),
              ),
            ],
          ),
          Column(
            children: [
              Text(
                "+0.00",
                style: TextStyle(
                  fontSize: 24.w,
                  color: Config.colorText1,
                ),
              ),
              Padding(padding: EdgeInsets.only(top: 8.w)),
              Text(
                "已完成",
                style: TextStyle(
                  fontSize: 24.w,
                  color: Config.colorText1,
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Config.colorBg2,
        appBar: AppBar(
          title: const Text('资产金券'),
          centerTitle: true,
        ),
        body: SizedBox(
          width: double.infinity,
          height: double.infinity,
          child: Column(
            children: [
              Container(
                width: double.infinity,
                height: 200.w,
                padding: EdgeInsets.symmetric(vertical: 25.w, horizontal: 20.w),
                margin: EdgeInsets.fromLTRB(30.w, 30.w, 30.w, 0),
                decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.circular(12.w),
                ),
                child: Column(
                  children: [
                    Column(
                      mainAxisAlignment: MainAxisAlignment.spaceAround,
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Row(
                          mainAxisAlignment: MainAxisAlignment.center,
                          children: [
                            Icon(
                              Icons.monetization_on_outlined,
                              size: 30.w,
                              color: Config.colorText1,
                            ),
                            Padding(
                              padding: EdgeInsets.only(left: 6.w),
                            ),
                            Text(
                              "资产金券",
                              style: TextStyle(
                                  fontSize: 24.sp, color: Config.colorText1),
                            ),
                          ],
                        ),
                        Padding(
                          padding: EdgeInsets.only(top: 8.w),
                        ),
                        Text(
                          "0.0000",
                          style: TextStyle(
                              fontSize: 28.sp,
                              color: Config.colorMain,
                              fontWeight: FontWeight.bold),
                        ),
                      ],
                    ),
                    Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Container(
                          margin: EdgeInsets.only(top: 20.w),
                          width: 120.w,
                          height: 46.w,
                          child: ElevatedButton(
                            clipBehavior: Clip.antiAlias,
                            onPressed: () => {
                              Routes.navigateTo(
                                  context, Routes.mineAssetExchange)
                            },
                            style: ButtonStyle(
                              elevation: MaterialStateProperty.all(0),
                              backgroundColor:
                                  MaterialStateProperty.all(Colors.white),
                              shape: MaterialStateProperty.all(
                                RoundedRectangleBorder(
                                  borderRadius: BorderRadius.circular(24.w),
                                ),
                              ),
                              side: MaterialStateProperty.all(
                                BorderSide(color: Config.colorMain, width: 2.w),
                              ),
                            ),
                            child: Text(
                              '兑换',
                              style: TextStyle(
                                  fontSize: 18.sp, color: Config.colorMain),
                            ),
                          ),
                        ),
                        Padding(
                          padding: EdgeInsets.only(left: 20.w, right: 20.w),
                        ),
                        Container(
                          margin: EdgeInsets.only(top: 20.w),
                          width: 120.w,
                          height: 46.w,
                          child: ElevatedButton(
                            clipBehavior: Clip.antiAlias,
                            onPressed: () => {
                              Routes.navigateTo(
                                  context, Routes.mineAssetTransition)
                            },
                            style: ButtonStyle(
                              elevation: MaterialStateProperty.all(0),
                              backgroundColor:
                                  MaterialStateProperty.all(Colors.white),
                              shape: MaterialStateProperty.all(
                                RoundedRectangleBorder(
                                  borderRadius: BorderRadius.circular(24.w),
                                ),
                              ),
                              side: MaterialStateProperty.all(
                                BorderSide(color: Config.colorMain, width: 2.w),
                              ),
                            ),
                            child: Text(
                              '互转',
                              style: TextStyle(
                                  fontSize: 18.sp, color: Config.colorMain),
                            ),
                          ),
                        ),
                      ],
                    ),
                  ],
                ),
              ),
              Container(
                width: double.infinity,
                height: 1044.w,
                padding: EdgeInsets.symmetric(vertical: 0, horizontal: 0.w),
                margin: EdgeInsets.symmetric(vertical: 30.w, horizontal: 30.w),
                decoration: BoxDecoration(
                  color: (Config.colorWhite),
                  borderRadius: BorderRadius.circular(12.w),
                ),
                child: ListView(
                  physics: const NeverScrollableScrollPhysics(),
                  padding: EdgeInsets.symmetric(vertical: 1.w, horizontal: 1.w),
                  children: [
                    getListItem("001", ""),
                    getListItem("002", ""),
                  ],
                ),
              ),
            ],
          ),
        ));
  }
}
